﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.UI.HtmlControls;
using System.Web.UI;

namespace Enterprise.Adapters
{
    /// <summary>
    /// Creates a nice indented head section instead of the messy original. It's easier to debug this code.
    /// </summary>
    public class HtmlHeadAdapter : System.Web.UI.Adapters.ControlAdapter
    {
        protected override void Render(HtmlTextWriter writer)
        {
            writer.WriteLine("<head>");
            writer.Write("\t<title>" + Page.Title + "</title>\n");
            HtmlHead headTag = (HtmlHead)this.Control;
            ControlCollection controls = headTag.Controls;
            for (int i = 0; i < controls.Count; i++)
            {
                Control c = controls[i];
                headTag.Controls[i].RenderControl(writer);
            }
            writer.Write("</head>");
        }
    }
}


